<?php $numProducts = $this->products->count() ?>

<?php if($numProducts == 0): ?>

<div id="bsk-left">

	<h2 class="bsk-title-bar">Warenkorb</h2>

	<p style="margin-top: 20px;">Sie haben zur Zeit keine Produkte in Ihrem Warenkorb.</p>

</div>

<?php else: ?>

<div id="bsk-left">

	<h2 class="bsk-title-bar">Warenkorb</h2>

	<div id="bsk-details">

		<form action="<?php echo $this->urlThisPage() ?>" method="post">
			<input type="hidden" name="sherpa_cart[action]" value="updateProducts" />
			<table cellspacing="0">

				<tr class="bsk-details-title">
					<th colspan="2" class="image-info">Produktdetails</td>
					<th class="quantity">Anzahl</td>
					<th class="price">Preis</td>
				</tr>

				<?php foreach($this->products AS $i => $product): ?>
					<?php $productId = $product->getProductId() ?>
					<tr class="bsk-details-data<?php echo $i == $numProducts - 1 ? ' last' : '' ?>">
						<td class="image">
							<?php if($imageFilename = $product->getImageFilename()): ?>
								<img src="<?php echo $this->productImagePath('m') ?><?php echo $imageFilename ?>" alt="" width="60" />
							<?php else: ?>
								Kein Bild
							<?php endif; ?>
						</td>
						<td class="info">
							<b><?php echo $product->getFullProductName() ?></b><br />
							Preis: <?php echo $this->config('currencyCode') ?> <?php echo $this->price($product->getPrice()) ?><br />
							Gr&ouml;sse: <?php echo $product->getSize() ?><br />
							Farbe: <?php echo $this->cartProductColors($product->getColorApplication()->getColors()) ?><br />
							<a href="<?php echo $this->urlThisPage(array('sherpa_cart' => array('action' => 'removeProduct', 'productId' => $productId))) ?>">entfernen</a>
						</td>
						<td class="quantity">
							<?php $name = 'sherpa_cart[productToQuantity][' . $productId . ']' ?>
							<?php echo $this->formSelect($name, $product->getQuantity(), array('onchange' => 'submit();'), $product->getQuantityRange()) ?><br />
						</td>
						<td class="price">
							<span class="currency"><?php echo $this->config('currencyCode') ?></span>
							<?php echo $this->price($product->getPriceTotal()) ?>
						</td>
					</tr>
				<?php endforeach; ?>
				<tr class="bsk-details-total">
					<td colspan="3" class="label">
						Zwischentotal
					</td>
					<td class="price">
						<span class="currency"><?php echo $this->config('currencyCode') ?></span>
						<?php echo $this->price($this->products->calculateSubtotal()) ?>
					</td>
				</tr>
                <?php echo $this->hook('Sherpa/View/Cart/Index/ProductsSubtotal') ?>
			</table>
		</form>

	</div>

	<div id="bsk-details-buttons"><a href="<?php echo $this->urlThisPage(array('sherpa_cart' => array('action' => 'removeAll'))) ?>"><img src="sherpa/img/btn-warenkorb-leeren.gif" width="127" height="23" alt="Warenkorb leeren" /></a></div>

</div>

<div id="bsk-right">

	<h2 class="bsk-title-bar">Bestellung</h2>

	<div id="bsk-summary">

		<div id="bsk-summary-coupon">
			<p>Gutschein-Code</p>

			<?php $this->form->setAction($this->urlThisPage(array('sherpa_cart' => array('action' => 'applyCouponCode')), null, false)) ?>
			<?php echo $this->form ?>
		</div>

		<table cellspacing="0" id="bsk-summary-total">
			<tr>
				<td class="label">
					Zwischentotal Einkauf
				</td>
				<td class="price">
					<span class="currency"><?php echo $this->config('currencyCode') ?></span>
					<?php echo $this->price($this->products->calculateSubtotal()) ?>
				</td>
			</tr>
			<?php echo $this->hook('Sherpa/View/Cart/Index/BasketSubtotal') ?>
			<?php if(($couponValue = $this->coupon->getValueRemaining()) > 0): ?>
			<tr>
				<td class="label">
					Gutschein
				</td>
				<td class="price">
					<span class="currency"><?php echo $this->config('currencyCode') ?></span>
					&ndash; <?php echo $this->price($couponValue) ?>
				</td>
			</tr>
			<?php endif; ?>
			<tr class="pre-total">
				<td class="label">
					Versand
				</td>
				<td class="price">
					<span class="currency"><?php echo $this->config('currencyCode') ?></span>
					<?php echo $this->price($this->products->calculateShippingCosts($this->coupon)) ?>
				</td>
			</tr>
			<tr class="total">
				<td class="label">
					Total Einkauf
				</td>
				<td class="price">
					<span class="currency"><?php echo $this->config('currencyCode') ?></span>
					<?php echo $this->price($this->products->calculateTotal($this->coupon)) ?>
				</td>
			</tr>
		</table>

	</div>

	<div id="bsk-summary-buttons"><?php if(!empty($this->lastVisitedProductUrl)): ?><a href="<?php echo $this->lastVisitedProductUrl ?>"><img src="sherpa/img/btn-weiter-einkaufen.gif" width="119" height="23" alt="Weiter einkaufen" /></a><?php endif; ?><a href="<?php echo $this->urlToPage($this->config('pageIdCheckoutLogin')) ?>"><img src="sherpa/img/btn-bestellen.gif" width="77" height="23" alt="Bestellen" /></a></p>

</div>

<?php endif; ?>
